package com.zeyi.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zeyi.blog.util.Tree;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 字典表(Dictionary)表实体类
 *
 * @author 黎先森
 * @since 2020-07-23 08:20:51
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Dictionary implements Serializable, Tree<Dictionary> {
    private static final long serialVersionUID = 1L;
    //ID
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;
    //父id
    private String pid;
    //名称
    private String dicName;
    //值
    private String dicValue;
    //组
    private String dicGroup;
    //排序
    private Integer dicSort;

    @TableField(exist = false)
    private List<Dictionary> children;

    @JsonIgnore
    @Override
    public String getParentId() {
        return pid;
    }

    @Override
    public void setChildren(List<Dictionary> children) {
        this.children = children;
    }

    @Override
    public List<Dictionary> getChildren() {
        return children;
    }
}